<template>
    <el-autocomplete
        v-model.trim="formData[$attrs.prop]"
        v-bind="$attrs"
        :placeholder="placeholder"
        :clearable="clearable"
        @select="doSelect"
    ></el-autocomplete>
</template>

<script>
export default {
    props: {
        formData: {
            type: Object,
            default: () => ({})
        },
        onSelect: {
            type: [Function, undefined],
            default: undefined
        },
        placeholder: {
            type: String,
            default: '请输入'
        },
        clearable: {
            type: Boolean,
            default: true
        }
    },
    methods: {
        doSelect(e) {
            if (this.onSelect) {
                this.onSelect(e)
            }
        }
    }
}
</script>

<style></style>
